/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MortgageCore;
import Household.Household;
import java.awt.Rectangle;
import java.awt.Point;
import java.awt.Color;
import java.awt.Graphics;
import simframe.util.*;
/**
 *
 * @author karakots  correct file
 */
public class TestClass {
    // knows how to draw houshold
    Rectangle mapImageRect = new Rectangle();
    final Household hh;

    // constructor
    public TestClass (Household hh) {
        this.hh = hh;
        this.mapImageRect.setRect(hh.getLoc().getX()-2,hh.getLoc().getY()-2,4,4);
    }

    public Rectangle getMapImageRect() {
        return mapImageRect;
    }

    public void drawMapImage(Graphics g) {
       if (hh.getSelected())
           g.setColor(Color.RED);
       else if (hh.isEvaluatingToday())
           g.setColor(Color.YELLOW);
       else
           g.setColor(Color.BLUE);
       g.fillRect((int)mapImageRect.getX(), (int)mapImageRect.getY(), (int)mapImageRect.getWidth(), (int)mapImageRect.getHeight());
       // if selected, draw link between HH and its bank
       // when cash flows, show the amount of cash moving along the link and the direction
    }

    public boolean hit(Point p) {
        boolean selected;
        if (mapImageRect.contains(p))
            selected = true;
        else
            selected = false;
        hh.setSelected(selected);
        return selected;
    }

}
